package cn.kgc.spring.service.impl;

import cn.kgc.spring.annotatios.AutoWired;
import cn.kgc.spring.mapper.UserMapper;
import cn.kgc.spring.service.UserService;

/**
 * @author 课工场
 * @date 2024/11/4
 * @description   如何能实现不使用new关键词  实现属性的初始化操作
 *
 * 23中设计模式之工厂模式    实例工厂   创建对象  BeanFactory
 */
public class UserServiceImpl implements UserService {

    // private UserMapper userMapper = new UserMapperImpl();
    // private UserMapper userMapper = BeanFactory.userMapperImpl();
    // private UserMapper userMapper = BeanFactory.getBean(OracleMapperImpl.class);

    @AutoWired
    private UserMapper userMapper;


    @Override
    public Boolean removeUser(Integer id) {
        System.out.println("UserServiceImpl");
        System.out.println("userMapper = " + userMapper);
        Integer line =  userMapper.deleteUser(id);
        return line==1;
    }
}
